eth_ecrecover

(alias) function eth_ecrecover(r: byte_array, s: byte_array, rec_id: integer, data_hash: byte_array): byte_array

Calculate Ethererum public key from a signature and a hash.

Does almost the same as the Solidity ecrecover(...) function, but isn't its strict equivalent.

How this function differs from the Solidity one:

  • takes rec_id instead of v, where rec_id = v - 27

  • other parameters (r, s, hash) are the same, but in a different order

  • returns a 64-byte public key, not a 20-byte address; the address is the last 20 bytes of keccak256(...) of the public key

Alias

Return

64-byte public key

Since

0.10.6

Parameters

r

The first component of the Ethereum signature

s

The second component of the Ethereum signature

rec_id

The recovery identifier, normally 0 or 1

data_hash

The byte array representing the hash that was signed

See also

`eth_sign()`

eth_sign()